#ifndef DISKSIZETABLE_H
#define DISKSIZETABLE_H

#include <QWidget>
#include <QTableWidget>
#include <QProcess>

class DiskSizeTable : public QTableWidget
{
    Q_OBJECT
public:
    explicit DiskSizeTable(QWidget* parent = 0);

    QColor getBgColor();
    QColor getPgrColor1();
    QColor getPgrColor2();
    QColor getPgrColor3();
    QColor getTextColor1();
    QColor getTextColor2();
    QColor getTextColor3();

    QSize sizeHint();
    QSize minimumSizeHint();

public slots:
    void loadData();
    void setBgColor(const QColor& color);

    void setPgrColor1(const QColor& color);
    void setPgrColor2(const QColor& color);
    void setPgrCOlor3(const QColor& color);

    void setTextColor1(const QColor& color);
    void setTextColor2(const QColor& color);
    void setTextColor3(const QColor& color);

signals:
    void sdDiskReceive(const QString& diskName);
    void uDiskReceive(const QString& diskName);

private:
    QProcess* process;

    QColor bgColor;
    QColor pgrColor1;
    QColor pgrColor2;
    QColor pgrColor3;
    QColor textColor1;
    QColor textColor2;
    QColor textColor3;

private slots:
    void readData();
    void checkSize(const QString& result, const QString& name);
    void insertSize(const QString& name, const QString& use,
                    const QString& free, const QString& all, int percent);

};

#endif // DISKSIZETABLE_H
